# $Id$
# Maintainer: Ronald van Haren <ronald.archlinux.org>
# Contributor: Jochem Kossen <j.kossen@home.nl>
# Contributor: Jason Chu <jason.archlinux.org>

pkgname=latex2html
pkgver=2017.2
pkgrel=2
pkgdesc="a convertor written in Perl that converts LaTeX documents to HTML."
arch=('any')
url="http://www.ctan.org/pkg/latex2html/"
depends=('perl' 'ghostscript' 'texlive-core' 'libpng' 'giflib' 'netpbm')
license=('GPL2')
source=(http://mirrors.ctan.org/support/${pkgname}/$pkgname-$pkgver.tar.gz
 install-destdir.patch)
sha1sums=('ed00007b1dc6d92fe4f3e4f60ebb7746408ef408'
          '7b654c41779b8387010b69abe4e5aa51d583c278')

prepare() {
        cd $srcdir/$pkgname-$pkgver
        patch -Np0 -i ${srcdir}/install-destdir.patch
}

build() {
	cd $srcdir/$pkgname-$pkgver
	./configure --prefix=/usr \
	    --shlibdir=/usr/lib/$pkgname \
	    --with-texpath=/usr/share/texmf/tex/latex/html \
	    --enable-gif \
	    --enable-png

	make
}

package() {
	cd $srcdir/$pkgname-$pkgver
	make DESTDIR=${pkgdir} install
	
	# set correct permission on executables
	chmod 755 $pkgdir/usr/bin/{pstoimg,texexpand,latex2html}

	# avoid conflict with TeXLive
	rm -f ${pkgdir}/usr/share/texmf/tex/latex/html/url.sty
}
